<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('数据集市列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>过滤：</label>
                                <input type="text" name="idIndex"/>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table class="table table-bordered">
                    <colgroup>
                        <col width="10%">
                        <col width="30%">
                        <col width="30%">
                        <col width="30%">
                    </colgroup>
                    <thead>
                    <tr>
                        <th></th>
                        <th>ID</th>
                        <th>编码</th>
                        <th>名称</th>
                    </tr>
                    </thead>
                    <tbody id="fildLIst" >
                    <tr th:each="item:${list}">
                        <td><input type="checkbox"></td>
                        <td th:text="${item.id}"></td>
                        <td th:text="${item.cd}"></td>
                        <td th:text="${item.na}"></td>
                        <td th:text="${item.idDrawDm}" style="display: none"></td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "etl/dm";
        function submitHandler() {

            var checkData = $("#fildLIst").find("input:checked");
            if(checkData.length<1) {
                $.modal.alertError("至少需要选择一条数据");
                return ;
            }
            var data=[],tds;
            $.each(checkData,function (index,item) {
                tds = $(this).parent().siblings();
                data.push({"id":tds[0].innerHTML,"idDrawDm":tds[3].innerHTML,"cd":tds[1].innerHTML,"na":tds[2].innerHTML});
            });
            $.ajax({
                url: prefix+"/saveRely",
                cache: false,
                async: false,
                type: 'POST',
                dataType: 'json',
                data: JSON.stringify(data),
                contentType: 'application/json;charset=UTF-8',
                success: function (result) {
                    if(result.code=="0") {
                        $.modal.close();
                    }
                }
            });
        }
    </script>
</body>
</html>